home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Dylan Related / Mindy-1.1 (sources only) / mindy-1.1 / libraries / streams / library.dylan < prev    next >
Encoding:
Text File  |  1994-08-25  |  5.3 KB  |  195 lines  |  [TEXT/ttxt]

  1. module: Dylan-User
  2. author: chiles@cs.cmu.edu
  3. synopsis: This file defines the Streams library and its modules.
  4. copyright: See below.
  5. rcs-header: $Header: library.dylan,v 1.11 94/08/23 10:33:39 chiles Exp $
  6.  
  7. //======================================================================
  8. //
  9. // Copyright (c) 1994  Carnegie Mellon University
  10. // All rights reserved.
  11. // 
  12. // Use and copying of this software and preparation of derivative
  13. // works based on this software are permitted, including commercial
  14. // use, provided that the following conditions are observed:
  15. // 
  16. // 1. This copyright notice must be retained in full on any copies
  17. //    and on appropriate parts of any derivative works.
  18. // 2. Documentation (paper or online) accompanying any system that
  19. //    incorporates this software, or any part of it, must acknowledge
  20. //    the contribution of the Gwydion Project at Carnegie Mellon
  21. //    University.
  22. // 
  23. // This software is made available "as is".  Neither the authors nor
  24. // Carnegie Mellon University make any warranty about the software,
  25. // its performance, or its conformity to any specification.
  26. // 
  27. // Bug reports, questions, comments, and suggestions should be sent by
  28. // E-mail to the Internet address "gwydion-bugs@cs.cmu.edu".
  29. //
  30. //======================================================================
  31. //
  32.  
  33.  
  34. ///
  35. /// These definitions go into the Dylan-User module because this is how we
  36. /// jumpstart a library.
  37. ///
  38.  
  39. define library streams
  40.   use dylan;
  41.   export streams, standard-io;
  42. end library;
  43.  
  44.  
  45. /// The Internals Module exports everything that is necessary to make the
  46. /// code in the Streams Module run.
  47. ///
  48. define module internals
  49.   use dylan;
  50.   use extensions,
  51.     import: {<boolean>, <byte-vector>, one-of, type-or, ignore, on-exit},
  52.     export: all;
  53.   use system,
  54.     import: {<buffer>, copy-bytes},
  55.     export: all;
  56.   use threads,
  57.     import: {<multilock>, <semaphore>, grab-lock, release-lock},
  58.     export: all;
  59.   use file-descriptors,
  60.     // This is one of two use file-descriptors clauses.  This one prefixes
  61.     // everything with "fd-"
  62.     import: {// Lseek values for whence argument.
  63.          l_set => fd-seek-start,
  64.          l_incr => fd-seek-current,
  65.          l_xtnd => fd-seek-end,
  66.  
  67.          // Open values for flags argument
  68.          o_rdonly, o_wronly, o_rdwr, o_creat, o_trunc, o_excl,
  69.  
  70.          // Open errors.
  71.          enoent, eexist},
  72.     prefix: "fd-",
  73.     export: all;
  74.   use file-descriptors,
  75.     // This is two of two use file-descriptors clauses.  This one does no
  76.     // prefixing.
  77.     import: {fd-read, fd-write, fd-open, fd-close, fd-seek,
  78.          fd-input-available?, fd-sync-output, fd-error-string},
  79.     export: all;
  80.   export
  81.     // Classes and types.
  82.     <byte>,
  83.     <byte-character>,
  84.     <fixed-integer>,
  85.  
  86.     // Constants.
  87.     $maximum-fixed-integer,
  88.  
  89.     // Utilities.
  90.     call-fd-function;
  91. end module;
  92.  
  93. define module streams
  94.   // These renames exist to test the module system.  After running this code
  95.   // once, we will remove these renames.
  96.   use dylan;
  97.   use internals,
  98.     import: {<boolean>, <byte-vector>, one-of, type-or, ignore, on-exit,
  99.  
  100.          <buffer>, copy-bytes,
  101.  
  102.          <multilock>, <semaphore>, grab-lock, release-lock,
  103.  
  104.          fd-seek-start, fd-seek-current, fd-seek-end, fd-o_rdonly,
  105.          fd-o_wronly, fd-o_rdwr, fd-o_creat, fd-o_trunc, fd-o_excl,
  106.          fd-enoent, fd-eexist, fd-read, fd-write, fd-open, fd-close,
  107.          fd-seek, fd-input-available?, fd-sync-output, fd-error-string,
  108.  
  109.          <byte>, <byte-character>, <fixed-integer>,
  110.          $maximum-fixed-integer, call-fd-function},
  111.     export: {<byte-vector>, <buffer>, <byte-character>, <byte>};
  112.   export
  113.     //
  114.     // Classes and types.
  115.     <stream>,
  116.     <file-stream>,
  117.     <string-stream>,
  118.     <string-input-stream>,
  119.     <byte-string-input-stream>,
  120.     <string-output-stream>,
  121.     <byte-string-output-stream>,
  122.     <buffer-index>,
  123.     //
  124.     // Constants.
  125.     $maximum-buffer-size,
  126.     //
  127.     // Conditions.
  128.     <end-of-file>,
  129.     <file-not-found>,
  130.     <file-exists>,
  131.     //
  132.     // Stream Extension Protocol.
  133.     close,
  134.     stream-extension-get-input-buffer,
  135.     stream-extension-release-input-buffer,
  136.     fill-input-buffer,
  137.     input-available-at-source?,
  138.     stream-extension-get-output-buffer,
  139.     stream-extension-release-output-buffer,
  140.     force-output-buffer,
  141.     synchronize-output-buffer,
  142.     //
  143.     // Basic I/O Protocol.
  144.     read-byte,
  145.     peek-byte,
  146.     read-line,
  147.     input-available?,
  148.     flush-input,
  149.     write-byte,
  150.     force-output,
  151.     synchronize-output,
  152.     //
  153.     // Buffer Access Protocol.
  154.     get-input-buffer,
  155.     release-input-buffer,
  156.     get-output-buffer,
  157.     release-output-buffer,
  158.     //
  159.     // Data Extension Protocol.
  160.     read-as,
  161.     read-into!,
  162.     write,
  163.     write-line,
  164.     //
  165.     // <random-access-stream> protocol.
  166.     stream-position,
  167.     stream-position-setter,
  168.     adjust-stream-position,
  169.     stream-size,
  170.     //
  171.     // <string-output-stream> protocol.
  172.     string-output-stream-string,
  173.     //
  174.     // <buffer> protocol.
  175.     buffer-subsequence,
  176.     copy-from-buffer!,
  177.     copy-into-buffer!,
  178.     //
  179.     // Conditions operations.
  180.     end-of-file-stream,
  181.     file-not-found-filename,
  182.     file-exists-filename,
  183.  
  184.     // The following are extensions to the standard Streams Library.
  185.     <fd-stream>;
  186. end module;
  187.  
  188. define module standard-io
  189.   use dylan;
  190.   use streams,
  191.     import: {<fd-stream>};
  192.   export
  193.     *standard-input*, *standard-output*, standard-error*;
  194. end module
  195.